<template>
	<view class="share_layout">
		<view class="title">
			{{$t('shareDevice.hint')}}
		</view>
		<view class="input-name">
			<input class="name" value="" placeholder-style="color:#999" :placeholder="$t('shareDevice.email')"
				@input="changeEmailContent" />
		</view>
		
		<view class="confirm" @click="confirm">
			{{$t('shareDevice.confirm')}}
		</view>
	</view>
</template>

<script setup>
	
	import { apiUserShareDevice } from '../../api/user_api';
	import { i18nTool } from '../../utils/i18en';
	import{onLoad}from"@dcloudio/uni-app";
import { getImei } from '../../utils/user_tools';
	
	let imei =  getImei();
	const param ={imei:imei};
	var email = null;
	async function confirm(){
		if(!email){
			uni.showToast({
				title:i18nTool('shareDevice.err'),
				icon:"none"
			})
			return;
		}
		param.email = email;
		let res = await apiUserShareDevice(param);
		uni.navigateBack();
		
	}
	
	onLoad(()=>{
		uni.setNavigationBarTitle({
			title:i18nTool("shareDevice.navTitle")
		})
	})
	
	function changeEmailContent(e){
		email = e.detail.value;
	}
	
</script>

<style lang="scss" scoped>
	.share_layout{
		padding:100rpx 40rpx;
		.title{
			color: #666;
			font-size: 26rpx;
		}
		.input-name {
			margin-top: 50rpx;
			border-bottom: 2rpx solid #BDBDBD;
			border-radius: 10rpx;
			height: 80rpx;
		
			.name {
				height: 100%;
				padding-left: 30rpx;
				padding-right: 15rpx;
				color: #333;
				font-size: 30rpx;
			}
		}
		.confirm {
			margin-top: 60rpx;
			height: 80rpx;
			color: #fff ;
			background-color:#53786C;
			border-radius: 40rpx;
			@include flex-box-set(center);
		
		}
	}
</style>

